package item.inkcloud.shopservice.service;

import item.inkcloud.shopservice.feignClient.UserServiceFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component
public class EmailService {

    @Autowired
    JavaMailSenderImpl mailSender;



    @Async
    public void email(String username, String email,String productName){

        String text = "尊敬的inkcloud用户 " + username + "，您在订阅系统中的 " + productName + " 订阅已成功!";
        SimpleMailMessage mailMessage = new SimpleMailMessage();
        mailMessage.setSubject("inkcloud服务");
        mailMessage.setText(text);
        mailMessage.setTo(email);
        mailMessage.setFrom("2742405107@qq.com");
        mailSender.send(mailMessage);





    }





}
